import request from '@/utils/request'

export default {
  // 获取爬虫信息管理界面的list
  listPage(page, limit, searchObj) {
    return request.service({
      url: `/crawler/web/listPage/${page}/${limit}`,
      method: 'post',
      data: searchObj
    })
  },

  // 获取爬虫负责人list
  getPersonList() {
    return request.service({
      url: `/crawler/web/getPersonList`,
      method: 'get'
    })
  },

  // 获取一键忽略list
  getDropdownList(id) {
    return request.service({
      url: `/crawler/web/getDropdownList`,
      method: 'get',
      params: {
        id
      }
    })
  },

  // 获取爬虫类型list
  getSpiderTypeList() {
    return request.service({
      url: `/crawler/web/getSpiderTypeList`,
      method: 'get'
    })
  },

  // 获取服务器list
  getMachineList(person, spiderType) {
    return request.service({
      url: `/crawler/web/getMachineList`,
      method: 'get',
      params: {
        'person': person,
        'spiderType': spiderType
      }
    })
  },

  // 获取项目名称list
  getProjectNameList(person, spiderType) {
    return request.service({
      url: `/crawler/web/getProjectNameList`,
      method: 'get',
      params: {
        'person': person,
        'spiderType': spiderType
      }
    })
  },

  // 获取预览信息弹窗的错误类型数量
  getPreview(id) {
    return request.service({
      url: `/crawler/web/getCrawlerPreview/${id}`,
      method: 'get'
    })
  },

  // 更换爬虫负责人
  updatePerson(id, person) {
    return request.service({
      url: `/crawler/web/updatePerson`,
      method: 'get',
      params: {
        id,
        person
      }
    })
  },

  // 修改备注
  updateRemarks(id, remarks) {
    return request.service({
      url: `/crawler/web/updateRemarks`,
      method: 'get',
      params: {
        id,
        remarks
      }
    })
  },

  // 绑定定时任务
  updateScheduledName(id, scheduledName, machine) {
    return request.service({
      url: `/crawler/web/updateScheduledName`,
      method: 'get',
      params: {
        id,
        scheduledName,
        machine
      }
    })
  },

  // 解绑定时任务
  unupdateScheduledName(id) {
    return request.service({
      url: `/crawler/web/unupdateScheduledName`,
      method: 'get',
      params: {
        id
      }
    })
  },

  // 置顶数据
  toppingData(formData) {
    return request.service({
      url: `/crawler/web/toppingData`,
      method: 'post',
      data: formData
    })
  },

  // 取消置顶
  unToppingData(formData) {
    return request.service({
      url: `/crawler/web/unToppingData`,
      method: 'post',
      data: formData
    })
  },

  // 标记爬虫是否无效
  setValid(formData) {
    return request.service({
      url: `/crawler/web/setValid`,
      method: 'post',
      data: formData
    })
  },

  // 获取爬虫总数量
  getCrawlerCount() {
    return request.service({
      url: `/crawler/web/getCrawlerCount`,
      method: 'get'
    })
  },

  // 获取今日爬虫错误数量
  getErrorCrawlerCount() {
    return request.service({
      url: `/crawler/web/getErrorCrawlerCount`,
      method: 'get'
    })
  },

  // 切换pdf爬虫
  changePdf(id) {
    return request.service({
      url: `/crawler/web/changePdf`,
      method: 'get',
      params: {
        id
      }
    })
  },

  // 切换不是pdf爬虫
  changePdf2(id) {
    return request.service({
      url: `/crawler/web/changePdf2`,
      method: 'get',
      params: {
        id
      }
    })
  },

  // 获取定时任务执行情况
  getScheduledTask(person, cancelToken) {
    return request.service({
      url: `/crawler/web/getScheduledTask`,
      method: 'get',
      params: {
        person
      },
      cancelToken: cancelToken
    })
  },

  // 远程联想搜索爬虫名称
  querySearchAsync(queryString, person, spiderType) {
    return request.service({
      url: `/crawler/web/querySearchAsync`,
      method: 'get',
      params: {
        'codeName': queryString,
        'person': person,
        'spiderType': spiderType
      }
    })
  },

  // 荣耀解析数据获取list
  honorListPage(page, limit, searchObj) {
    return request.service({
      url: `/crawler/web/honorListPage/${page}/${limit}`,
      method: 'post',
      data: searchObj
    })
  },

  // 荣耀解析更新处理状态
  honorUpdateData(id, status) {
    return request.service({
      url: `/crawler/web/honorUpdateData`,
      method: 'get',
      params: {
        'id': id,
        'status': status
      }
    })
  },

  // 荣耀解析批量处理
  honorMultipleHandle(formData) {
    return request.service({
      url: `/crawler/web/honorMultipleHandle`,
      method: 'post',
      data: formData
    })
  },

  // 获取荣耀解析来源list
  honorAuthorList() {
    return request.service({
      url: `/crawler/web/honorAuthorList`,
      method: 'get'
    })
  },

  // 获取荣耀解析奖项list
  honorPrizeList() {
    return request.service({
      url: `/crawler/web/honorPrizeList`,
      method: 'get'
    })
  },

  // 获取企业备案爬虫详情
  getCompanyRecordDetail(id) {
    return request.service({
      url: `/crawler/web/getCompanyRecordDetail/${id}`,
      method: 'get'
    })
  },

  // 校验最近数据的author是否存在
  verifiedAuthor(author) {
    return request.service({
      url: `/crawler/web/verifiedAuthor`,
      method: 'get',
      params: {
        author
      }
    })
  },

  // 获取爬虫运行数量
  getCrawlerValidCount(person) {
    return request.service({
      url: `/crawler/web/getCrawlerValidCount`,
      method: 'get',
      params: {
        person
      }
    })
  }

}
